<?php
/*
*	Kleophatra - Open Source Content Management System
*	------------------------------------------------------------------------
*	Copyright (C) 2007-2010, Sergio Milardovich <smilardovich@yahoo.com.ar>
*	This program is Free Software.
*
*	@package	Kleophatra
*	@subpackage	/lib
*	@license	http://www.gnu.org/copyleft/gpl.html GNU/GPL License 2.0
*	@author		Sergio Milardovich <smilardovich@yahoo.com.ar>
*	@link		http://www.kleophatra.org
*/
  require_once KLEO_LIB_DIR.'core.lib.php';
  class delicious extends kleocore{
    var $user = $this->get_core_value('delicious_username', 'name');
    var $pass = $this->get_core_value('delicious_password', 'name');
    var $api = 'api.del.icio.us/v1';

    function make_post_url($url,$tags,$description){
      $url = urlencode($url);
      $tags = urlencode($tags);
      $description = urlencode($description);
      return 'https://'.$this->user.':'.$this->pass.'@'.$this->api.'/posts/add?url='.$url.'&description='.$description.'&tags='.$tags;
    }
    function post_url($url,$tags,$description){
      $call = $this->make_post_url($url,$tags,$description);
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,$call);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
      curl_setopt($ch, CURLOPT_USERAGENT, 'php-curl'); 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
      curl_exec ($ch);
    }
  }
?>
